<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <%@ include file="/WEB-INF/include/commoncss.jsp"%>
    <script type="text/javascript"
            src="${ctx}/javascript/laydate/laydate.js"></script>
</head>
<body>
<article class="page-container">
    <div action="" class="form form-horizontal" id="scheduleAdd">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>中文国名：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="nation_z" name="nation_z" value="${overseaschinese.nation_z}" class="input-text" disabled/>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>华侨数量：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" name="huaqiao_number" id="huaqiao_number" class="input-text" value="${overseaschinese.huaqiao_number}"/>
            </div>
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>统计年份：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" name="census_time" id="census_time" class="input-text" value="${overseaschinese.census_time}"/>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">统计报表：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input placeholder="用逗号隔开" type="text" name="statistics" id="statistics" class="input-text" value="${overseaschinese.statistics}"/>
            </div>
            <label class="form-label col-xs-4 col-sm-2">相关文献：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input placeholder="用逗号隔开" type="text" name="conferences" id="conferences" class="input-text" value="${overseaschinese.conferences}"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">移民历史：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="immigrant_history" name="immigrant_history" cols="130" rows="5">${overseaschinese.immigrant_history}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">华侨社团：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="huaqiao_association" name="huaqiao_association" cols="130" rows="5" value="" >${overseaschinese.huaqiao_association}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">华文媒体：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="chinese_media" name="chinese_media" cols="130" rows="5" value="" >${overseaschinese.chinese_media}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">华文学校：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="chinese_school" name="chinese_school" cols="130" rows="5" value="" >${overseaschinese.chinese_school}</textarea>
            </div>

        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>来源：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="reference" name="reference" cols="130" rows="5" value="" >${overseaschinese.refrence}</textarea>
            </div>

        </div>
        <div class="row cl">
            <div class="col-xs-8  col-xs-offset-5 ">
                <button value="${overseaschinese.country_code}" type="button" class="btn btn-success radius" onClick="update_politic(this.value)">提交</button>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <button id="close" value="${overseaschinese.recoder_id}" onClick="layer_close();" class="btn btn-default radius" type="button"> 关闭</button>
            </div>
        </div>
    </div>
    <%@ include file="/WEB-INF/include/commonjs.jsp"%>
    <script>
        function update_politic(value){
            var recorder=document.getElementById("close").value;
            var YHZH=parent.parent.document.getElementById("YHZH").innerText;
            if(YHZH.substring(0,3)!='001'&&YHZH.substring(0,3)!=recorder){
                layer.msg("你不能修改不是别人的内容只能查看",{icon:2,time:2000});
                return;
            }
            var conferences=document.getElementById("conferences").value;
            var statistics=document.getElementById("statistics").value;
            var huaqiao_number=document.getElementById("huaqiao_number").value;
            var census_time=document.getElementById("census_time").value;
            var immigrant_history=document.getElementById("immigrant_history").value;
            var huaqiao_association=document.getElementById("huaqiao_association").value;
            var chinese_media=document.getElementById("chinese_media").value;
            var chinese_school=document.getElementById("chinese_school").value;
            var reference=document.getElementById("reference").value;
            if(((huaqiao_number!=null&&huaqiao_number!="")&&(census_time==null||census_time==""))
                ||((huaqiao_number==null||huaqiao_number=="")&&(census_time!=null&&census_time!=""))){
                layer.msg("华侨数量和年份必须同时填写或都不填",{icon:2,time:2000});
                return;
            }
            else if(reference==""||reference==null){
                layer.msg("*为必填项",{icon:2,time:2000});
                return;
            }
            layer.confirm("确认提交吗",{btn:['确定','取消']},function(){

                var url="${ctx}/OverseasChinese/overseaschinese_update.do";
                var parameter={statistics:statistics,conferences:conferences,huaqiao_number:huaqiao_number,census_time:census_time,immigrant_history:immigrant_history
                    ,huaqiao_association:huaqiao_association,chinese_media:chinese_media,chinese_school
                        :chinese_school,country_code:value,refrence:reference };
                $.post(url,parameter,function(data){
                    if(data=="修改成功"){
                        layer.msg(data,{icon:1,time:2000},function(){
                            parent.location.reload(true);
                        })
                    }else{
                        layer.msg(data,{icon:2,time:2000});
                    }
                })
            })
        }

    </script>
</article>


</body>

</html>